<!DOCTYPE HTML>
<html>
<head>
    <include file="Common:header_include"/>
    <title>编辑用户</title>
</head>
<body>
<div class="pd-20">
    <form action="{:U('edit')}" method="post" class="form form-horizontal" id="form">
        <input type="text" name="id" hidden value="{$data.id}">
        <div class="row cl">
            <label class="form-label col-3"><span class="c-red"></span>用户等级：</label>
            <div class="formControls col-6">
                <span class="select-box">
                <select class="select" size="1" name="level_id">
                    <volist name=":getLevelList()" id="item">
                        <option value="{$item.id}" <if condition="$item['id'] eq $data['level_id']">selected</if>>{$item.title}</option>
                    </volist>
                </select>
                </span>
            </div>
            <div class="col-4"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-3"><span class="c-red">*</span>用户名：</label>
            <div class="formControls col-6">
                <input type="text" class="input-text" name="name" datatype="s3-18" value="{$data.name}">
            </div>
            <div class="col-4"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-3"><span class="c-red"></span>密码：</label>
            <div class="formControls col-6">
                <input type="text" class="input-text" placeholder="请输入6-18位字符" name="pwd" onfocus="this.type='password'">
            </div>
            <div class="col-4"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-3"><span class="c-red"></span>密码确认：</label>
            <div class="formControls col-6">
                <input type="text" class="input-text" placeholder="请输入6-18位字符" name="pwd2" onfocus="this.type='password'">
            </div>
            <div class="col-4"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-3"><span class="c-red"></span>头像：</label>
            <div class="formControls col-6">
                <input type="file" class="input-text" placeholder="请输入" name="coverFile">
            </div>
            <div class="col-2">
                <if condition="$data['cover']">
                    已上传，<a href="javascript:void(0);" onclick="previewPictures('__UPS__{$data.cover}')">预览</a>
                </if>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-3"><span class="c-red"></span>性别：</label>
            <div class="formControls col-6">
                <span class="select-box">
                <select class="select" size="1" name="gender">
                    <option value="" selected="" disabled="disabled">请选择</option>
                    <option value="1" <if condition="$data['gender'] eq 1">selected</if>>男</option>
                    <option value="0" <if condition="$data['gender'] eq 0">selected</if>>女</option>
                </select>
                </span>
            </div>
            <div class="col-4"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-3"><span class="c-red"></span>年龄：</label>
            <div class="formControls col-6">
                <input type="text" class="input-text" placeholder="请输入" name="age" value="{$data.age}">
            </div>
            <div class="col-4"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-3"><span class="c-red"></span>出生日期：</label>
            <div class="formControls col-6">
                <input type="text" class="input-text" placeholder="请输入" name="birthday" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'});" value="{$data.birthday}">
            </div>
            <div class="col-4"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-3"><span class="c-red"></span>真实姓名：</label>
            <div class="formControls col-6">
                <input type="text" class="input-text" placeholder="请输入" name="true_name" value="{$data.true_name}">
            </div>
            <div class="col-4"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-3"><span class="c-red"></span>昵称：</label>
            <div class="formControls col-6">
                <input type="text" class="input-text" placeholder="请输入" name="nick" value="{$data.nick}">
            </div>
            <div class="col-4"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-3"><span class="c-red"></span>手机号：</label>
            <div class="formControls col-6">
                <input type="text" class="input-text" placeholder="请输入" name="phone" <if condition="!empty($data['phone'])"> value="{$data.phone}"</if>>
            </div>
            <div class="col-4"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-3"><span class="c-red"></span>邮箱：</label>
            <div class="formControls col-6">
                <input type="text" class="input-text" placeholder="请输入" name="email" value="{$data.email}">
            </div>
            <div class="col-4"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-3"><span class="c-red"></span>积分：</label>
            <div class="formControls col-6">
                <input type="text" class="input-text" placeholder="请输入" name="integral" value="{$data.integral}">
            </div>
            <div class="col-4"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-3"><span class="c-red"></span>描述：</label>
            <div class="formControls col-6">
                <input type="text" class="input-text" placeholder="请输入" name="describe" value="{$data.describe}">
            </div>
            <div class="col-4"></div>
        </div>
        <div class="row cl">
            <div class="col-6 col-offset-3">
                <input class="btn btn-primary radius" type="submit" value="提交">
            </div>
        </div>
    </form>
</div>
</div>
<include file="Common:footer_include"/>
<script>
    $(function(){
        selectUserGroup($('input[name="user_group_id"]'));
    });
    /**
     * 切换表单必填项
     * @param obj
     */
    function selectUserGroup(obj) {
        var value = obj.val();
        if (value == 2) {
            $('.patient').hide();
            $('.doctor').show();
        } else if (value == 3) {
            $('.patient').show();
            $('.doctor').hide();
        } else {
            $('.patient').hide();
            $('.doctor').hide();
        }
    }

    $('.skin-minimal input').iCheck({
        checkboxClass: 'icheckbox-blue',
        radioClass: 'iradio-blue',
        increaseArea: '20%'
    });

</script>
</body>
</html>